﻿/*******************************************************************************
 * Copyright © 2016 luomingui 版权所有
 * Website：http://luomingui.cnblogs.com
 * Author: Luomg
 * CreateDate: 2023年8月6日 
 * Description: sys_user 用户信息表

*********************************************************************************/

using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using MiniExcelLibs.Attributes;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;

namespace Lmg.Model
{
    /// <summary>
    ///  用户信息表  
    /// </summary>
    [System.Diagnostics.DebuggerDisplay("user_id:{user_id}, user_name:{user_name}")]
    public partial class sys_user
    {
        /// <summary>
        /// 用户ID
        /// </summary>	
        [ExcelColumn(Name = "用户ID")]
        public long user_id { get; set; }
        /// <summary>
        /// 部门ID
        /// </summary>		
        [ExcelColumn(Name = "部门ID")]
        public string dept_id { get; set; }
        /// <summary>
        /// 用户当前角色
        /// </summary>	
        [ExcelColumn(Name = "用户当前角色")]
        public string role_id { get; set; }
        /// <summary>
        /// 登录账号
        /// </summary>		
        [ExcelColumn(Name = "登录账号")]
        public string login_name { get; set; }
        /// <summary>
        /// 用户昵称
        /// </summary>		
        [ExcelColumn(Name = "用户昵称")]
        public string user_name { get; set; }
        /// <summary>
        /// 用户类型
        /// </summary>		
        [ExcelColumn(Name = "用户类型")]
        public int user_type { get; set; }
        /// <summary>
        /// 用户邮箱
        /// </summary>		
        [ExcelColumn(Name = "用户邮箱")]
        public string email { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>	
        [ExcelColumn(Name = "联系电话")]
        public string phone { get; set; }
        /// <summary>
        /// 用户性别
        /// </summary>		
        [ExcelColumn(Name = "用户性别")]
        public int sex { get; set; }
        /// <summary>
        /// 头像路径
        /// </summary>		
        [ExcelIgnore]
        [JsonIgnore]
        [ExcelColumn(Name = "头像路径")]
        public string avatar { get; set; }
        /// <summary>
        /// 登录密码
        /// </summary>	
        [ExcelIgnore]
        [JsonIgnore]
        public string password { get; set; }
        /// <summary>
        /// 盐加密
        /// </summary>
        [ExcelIgnore]
        [JsonIgnore]
        public string salt { get; set; }
        /// <summary>
        /// 帐号状态
        /// </summary>		
        [ExcelColumn(Name = "帐号状态")]
        public int status { get; set; }
        /// <summary>
        /// 删除标志
        /// </summary>		
        [ExcelColumn(Name = "删除标志")]
        [ExcelIgnore]
        public int del_flag { get; set; }
        /// <summary>
        /// 最后登录IP
        /// </summary>		
        [ExcelColumn(Name = "最后登录IP")]
        public string login_ip { get; set; }
        /// <summary>
        /// 最后登录时间
        /// </summary>		
        [ExcelColumn(Name = "最后登录时间")]
        public string login_date { get; set; }
        /// <summary>
        /// 密码最后更新时间
        /// </summary>		
        [ExcelColumn(Name = "密码最后更新时间")]
        public string pwd_update_date { get; set; }
        /// <summary>
        /// 创建者
        /// </summary>		
        [ExcelIgnore]
        public string create_by { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>	
        [ExcelIgnore]
        [ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss")]
        [DataType(DataType.Date, ErrorMessage = "Invalid create_time Format")]
        public DateTime? create_time { get; set; }
        /// <summary>
        /// 更新者
        /// </summary>		
        public string update_by { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>		
        [ExcelIgnore]
        [ExcelColumn(Name = "更新时间", Format = "yyyy-MM-dd HH:mm:ss")]
        [DataType(DataType.Date, ErrorMessage = "Invalid update_time Format")]
        public DateTime? update_time { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [ExcelColumn(Name = "备注")]
        public string remark { get; set; }
        /// <summary>
        /// 学历
        /// </summary>		
        [ExcelColumn(Name = "学历")]
        public string education { get; set; }
        /// <summary>
        /// 学位
        /// </summary>		
        [ExcelColumn(Name = "学位")]
        public string degree { get; set; }
        /// <summary>
        /// 专业领域
        /// </summary>		
        [ExcelColumn(Name = "专业领域")]
        public string professional { get; set; }
        /// <summary>
        ///  技术能力
        /// </summary>		
        [ExcelColumn(Name = "技术能力")]
        public string technical { get; set; }
        /// <summary>
        /// 单位
        /// </summary>		
        [ExcelColumn(Name = "单位")]
        public string unit { get; set; }
        /// <summary>
        /// 岗位类别
        /// </summary>	
        [ExcelColumn(Name = "岗位类别")]
        public string post_type { get; set; }
        [ExcelIgnore]
        public string WelcomeContent { get; set; }
        [ExcelIgnore]
        public string WelcomeMessage
        {
            get
            {
                int now = DateTime.Now.Hour;

                if (now > 0 && now <= 6)
                {
                    return "午夜好";
                }
                else if (now > 6 && now <= 11)
                {
                    return "早上好";
                }
                else if (now > 11 && now <= 14)
                {
                    return "中午好";
                }
                else if (now > 14 && now <= 18)
                {
                    return "下午好";
                }
                else
                {
                    return "晚上好";
                }
            }
        }

        public bool IsAdmin()
        {
            return IsAdmin(user_id);
        }
        public static bool IsAdmin(long userId)
        {
            return 1 == userId;
        }
    }
}

